const state={
   MusicUrl:{},
   Musiclist:[],
   times:"00:00",
   video:{},
   userName:JSON.parse(localStorage.getItem("userName")) || {},
   recordslist:JSON.parse(localStorage.getItem("records")) || [],
   cookie: JSON.parse(localStorage.getItem("cookie")) || "",
   showLrc:false,
   passIndex:1

}
const mutations={
  passUrl(state,data){
    var arr =data.time.split(":")
    data.time=arr[0]*60+parseInt(arr[1])
    state.MusicUrl=data
  },
  PresonUser(state,userName){
   
    console.log("清除",userName)
     state.userName=userName
  },
  searchRecords(state,records){ //存储搜索记录
      state.recordslist=[...new Set(records)]
      console.log("检查数组重复",state.recordslist)
      localStorage.setItem("records",JSON.stringify(state.recordslist))
  },
  Muisclist(state,data){ //存储歌曲用于播放上一首和下一首 随机播放
      state.Musiclist=data
  },
  video(state,data){
      state.video=data
  },
  showLrc(state,data){
     state.showLrc=data
  },
  passIndex(state,data){ //高亮主页的选项
      state.passIndex=data
  }
}
const actions={
   
}
const getters={

}

export default{
  state,
  mutations,
  actions,
  getters
}